package com.zhuanzhuan.hero.user.mq.consumer;

import com.bj58.youpin.common.utils.json.JsonUtils;
import com.zhuanzhuan.hero.user.mq.dto.MemberEventMsg;
import com.zhuanzhuan.hero.user.service.HeroUserInfoService;
import com.zhuanzhuan.hunter.mq.consumer.anno.HunterConsumer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @ClassName HeroMemberConsumer
 * @Description
 * @Author hanjunjun
 * @Date 2024/7/13 13:47
 */
@Slf4j
@Component
public class HeroMemberConsumer {

    @Resource
    private HeroUserInfoService userInfoService;

    @HunterConsumer(topic = "heroMemberMsgTopic", group = "memberUserGroup")
    public boolean memberInfoUpdate(String msgId, MemberEventMsg body) {
        log.info("会员信息变更 msgId={} body={}", msgId, JsonUtils.toJsonWithoutNull(body));
        return userInfoService.updateMemberInfo(body);
    }


}
